<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //concat()
        //  合并数组或元素，返回新的数组，原数组不会改变
        let hero1 = ['李白','韩信','亚瑟',];
        let hero2 = ['鲁班','后羿'];
        let hero3 = ['公孙离','安琪拉'];
        let clothes = ['吕布'];


        //1.参数是一个或者多个数据
        //let result=hero1.concat(hero2);
        let result=hero1.concat(hero2,hero3);

        //2.原数组不受影响
        //console.log(hero1,hero2,result);
       console.log(result);


       //参数是元素
         let result1=clothes.concat("天魔缭乱");//数组中添加元素;clothes为数组名
         console.log(result1);// 数组名.concat("天魔缭乱")
    </script>
</body>
</html>